<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>服务-医疗服务（医疗康复） 编辑页面</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <jsp:include page="../com/header.jsp"></jsp:include>
        <script type="text/javascript" src="../../js/comm/editcomm.js"></script>
        <script type="text/javascript">
		$(function(){
			//getDataById(root + 'cms/medicalService/findMedicalServiceById',"#medicalServiceTmpl","#medicalServiceContent");
			$("#saveOrupdate").click(function(){
				

				if (!$('#medicalServiceContent').find('#myImageShow').attr('src') {
					myAlert("请上传图片");
					return;
				}
				saveData(root + 'cms/medicalService/saveMedicalService','medicalServiceList.jsp');
			});
			
		
			
			var tId = getUrlParam("id");
			if (!tId) {
				myAlert('id参数不能为空');
				return;
			}
			$.ajax({
				url : root + 'cms/medicalService/findMedicalServiceById',
				type : 'post',
				dataType : 'json',
				data : {
					modelId : tId
				},
				success : function(data) {
					console.log(data);
					if (data.code == 1) {
						var contentHtml = $('#medicalServiceTmpl').render(data.object, {
							mydata : data
						});
						$('#medicalServiceContent').html(contentHtml);
						ue = UE.getEditor("merchant_ServiceContent");
						ue.addListener("ready", function() {
							if (data.object.merchant_ServiceContent)
								ue.setContent(data.object.merchant_ServiceContent);
						});
						
					}else{
						var contentHtml = $('#medicalServiceTmpl').render("");
						$('#medicalServiceContent').html(contentHtml);
					}
				}
			});


			//上传图片
            upload("medicalService");
		});
        </script>
    </head>
    <body>
      <section>
          <div>
              <div class="col-xs-12">
                  <div class="box" style="height:900px">
                      <div class="box-header">
                      <br>
                          <input type="button" value="确定" id="saveOrupdate" class="btn btn-success">
                          <button onclick="backAction('medicalServiceList.jsp');" class="btn btn-info" >返回</button>

                      </div>
                     <form id="submit_form" class="form-horizontal">
                        <div class="tab" id="medicalServiceContent">
                  	    </div>
                  	 </form>
              </div>
          </div>
      </section>
      <script type="text/x-jsrender" id="medicalServiceTmpl">
			<fieldset> 
				<input type="hidden" id="tId" name="id" value="{{:id}}" />
	        	{{!--<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">图片：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
                        	<img id="myImageShow" src="../../{{:imgUrl}}" width="100px" height="100px" />
                        	<input type="hidden" id="imgUrl" name="imgUrl" value="{{:imgUrl}}"/>
                        	<input type="file" id="uploadPhotoFile" name="photoFile" class="upload_file">
                        </div>
					</div>
      			</div>--}}
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">商家名称：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写商家名称" class="form-control input-sm" data-rule="required;length[0~50]" id="merchant_Name" name="merchant_Name" value="{{:merchant_Name}}" />
					</div>
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">商家电话：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写商家电话" class="form-control input-sm" data-rule="required;length[0~50];tel || mobile" id="merchant_Telphone" name="merchant_Telphone" value="{{:merchant_Telphone}}" />
					</div>
				</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">服务价格：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写服务价格" class="form-control input-sm" data-rule="required;length[0~50];money" id="merchant_ServicePrice" name="merchant_ServicePrice" value="{{:merchant_ServicePrice}}" />
					</div>
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">商家地址：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写地址" class="form-control input-sm" data-rule="required;length[0~255]" id="merchant_Address" name="merchant_Address" value="{{:merchant_Address}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">医疗中心图片：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
						<img id="myImageShow" src="../../{{:merchant_URL}}" width="100px" height="100px" />
                        	<input type="hidden" id="merchant_URL" name="merchant_URL" value="{{:merchant_URL}}"/>
                        	<input type="file" id="uploadPhotoFile" name="photoFile" class="upload_file">
						</div>
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">项目简介：</label>
       				 <div class="col-md-3">
						<textarea class="form-control" id="merchant_ServiceName" name="merchant_ServiceName" rows="8"
       				    placeholder="请填写服务项目简介"
       				    data-rule="required;length[1~50];" date-tip="请输入服务项目简介1-50字符"
       				    value="{{:merchant_ServiceName}}" style="resize:none;">{{:merchant_ServiceName}}</textarea>
					</div>
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">注意事项：</label>
       				 <div class="col-md-3">
						<textarea class="form-control" id="merchant_Attention" name="merchant_Attention" rows="8"
       				    placeholder="请填写服务项目简介"
       				    data-rule="required;length[1~50];" date-tip="请输入服务项目简介1-50字符"
       				    value="{{:merchant_Attention}}" style="resize:none;">{{:merchant_Attention}}</textarea>
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">服务内容：</label>
       				 <div class="col-md-3">
						<div  id="merchant_ServiceContent" name="merchant_ServiceContent" style="height:200px;width:760px"></div>	
					</div>
      			</div>
			</fieldset>
	</script>
    </body>
</html>